package com.rd.student.wulian.wanggaobo.day0728.practice02;

import java.util.ArrayList;
import java.util.List;

public class FindSushu {

    public static int count(int num) {
        int count = 0;


        for (int i = 2; i <= num; i++) {
            if (issushu(i)) {
                count++;
            }
        }

        return count;
    }

    public static boolean issushu(int num) {
        if (num <= 1) {
            return false;
        }


        for (int i = 2; i < num; i++) {
            if (num % i == 0) {
                return false;
            }
        }

        return true;
    }

    public static List<Integer> findsushu(int num) {
        List<Integer> sushu = new ArrayList<>();

        for (int i = 2; i <= num; i++) {
            if (issushu(i)) {
                sushu.add(i);
            }
        }

        return sushu;
    }
}